package com.sunlands.qdcy.tongzhuo.repository;

import com.sunlands.qdcy.tongzhuo.model.DiaryDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author anjl
 * @date 2019/5/2914:32
 */
@Repository
public interface DiaryRepository extends JpaRepository<DiaryDO, Long>,JpaSpecificationExecutor<DiaryDO> {

    List<DiaryDO> findByUserId(Long userId);

    Long countByTopicIdAndCreateTypeNot(Long topicId, Integer createType);

    Long countByUserIdAndCreateTypeNot(Long userId, Integer createType);

    List<DiaryDO> findAllByForwardIdIn(List<Long> forwardIds);
}
